package ev.utility;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class DataReader{
		private File f = null;
		private BufferedReader br = null;
		public DataReader(String fileName){
				try{
						f = new File(fileName);
						if(!f.exists()){
								f.createNewFile();
						}
						br = new BufferedReader(new InputStreamReader(
												new FileInputStream(f)));
				}catch(Exception e){
						e.printStackTrace();
						System.exit(1);
				}
		}
		public String readLine(){
				String str = null;
				try{
						str = br.readLine();
				}catch(Exception e){
						e.printStackTrace();
				}
				return str;
		}
		public void close(){
				try{
						br.close();
				}catch(Exception e){
						e.printStackTrace();
				}
		}
		public void clean(String remain,String delete){
				File rem = new File(remain);
				File del = new File(delete);
				if(del.exists()){
						boolean flag = del.delete();
						if(!flag){
								System.out.println("删除失败");
						}
				}
				rem.renameTo(del);
		}
}
